﻿using CountryDepth.Library.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CountryDepth.Library.BusinessLogic
{
    public class BLVacationRequest
    {
        #region Public Properties

        public int VacationId { get; set; }
        public Item User { get; set; }
        public DateTime DateAdded { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Comment { get; set; }
        public bool Approved { get; set; }
        public Item ApprovedBy { get; set; }
        public Item VacationType { get; set; }

        public List<VacationDetail> VacationDetails { get; set; }

        #endregion

        #region Public Methods

        public bool Save()
        {
            try
            {
                return Main.SaveVacation(this);
            }
            catch (Exception exc)
            {
                return false;
            }
        }

        public bool ApproveVacation(int userId)
        {
            try
            {
                return Main.ApproveVacation(this.VacationId, userId);
            }
            catch (Exception exc)
            {
                return false;
            }
        }

        public bool DeleteVacation()
        {
            try
            {
                return Main.DeleteVacation(this.VacationId);
            }
            catch (Exception exc)
            {
                return false;
            }
        }

        public List<BLVacationRequest> GetVacationRequestsByUserId(int UserId)
        {
            return null;
        }

        #endregion
    }
}
